package com.lzq.mq.broker.core;

import java.util.HashMap;
import java.util.Map;

/**
 * topic的MMap映射管理器
 */
public class CommitLogMMapFileModelManager {

    /**
     * key-MMap映射
     */
    private final Map<String, CommitLogMMapFileModel> mMapFileModelMap = new HashMap<>();

    /**
     * 添加话题和MMapFileMode
     * @param topic 主题
     * @param mapFileModel MMapFileMode
     */
    public void put(String topic, CommitLogMMapFileModel mapFileModel) {
        mMapFileModelMap.put(topic, mapFileModel);
    }

    /**
     * 获取话题的MMapFileMode
     * @param topic 主题
     * @return MMapFileMode
     */
    public CommitLogMMapFileModel get(String topic) {
        return mMapFileModelMap.get(topic);
    }

}
